package com.lzq.config;

import java.sql.SQLException;
import java.util.List;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import com.lzq.domain.TCourse;
import com.lzq.service.MyCourseService;


public class MainStarter {

	public static void main(String[] args) throws SQLException {
		
		AnnotationConfigApplicationContext ctx=new AnnotationConfigApplicationContext();
		ctx.getEnvironment().setActiveProfiles("production");
		ctx.scan("com.lzq"); 
		ctx.refresh();
		MyCourseService courseService=ctx.getBean(MyCourseService.class);
		System.out.println("生产环境，查询实际数据库");
		List<TCourse> courses=courseService.getAllCourse();
		courses.forEach(System.out::println);
		
		ctx.close();
	}
}
